﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpages/Main.master" AutoEventWireup="true" CodeFile="Documents.aspx.cs" Inherits="User_Shares_Documents" %>

<%@ Register src="../../Controls/FileUpload/MultipleFileUpload.ascx" tagname="MultipleFileUpload" tagprefix="uc1" %>

<%@ Register src="../../Controls/FileDownload/FileDownload.ascx" tagname="FileDownload" tagprefix="uc2" %>

<%@ Register src="../../Controls/ContentHolder/Holder1.ascx" tagname="Holder1" tagprefix="uc3" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style1
        {
            text-align:right;
            width: 100%;
            font-family:Tahoma;
            font-size:x-small;
            direction:rtl;
        }
        .style2
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    
      
     
    <%--  <asp:LoginView runat="server">
             <RoleGroups>
                 <asp:RoleGroup Roles="Admin"> 
           
                     <ContentTemplate>--%>
                         <table class="style1" style="text-align:right">
                             <tr>
                                 <td>   <asp:Panel ID="PanelUpload" runat="server" BorderStyle="Solid" 
                                         BorderWidth="1px" ScrollBars="Auto" Direction="RightToLeft" CssClass="style1">
                                 <uc3:Holder1 ID="Holder11" runat="server"  Title="ارسال مدارک">
                                 <ContentTemplate>
                                 
                                
                                  
                                         <table class="style1" dir="rtl">
                                             <tr>
                                                 <td>
                                                     <asp:Label ID="Label1" runat="server" Text="نوع سند :"></asp:Label>
                                                 </td>
                                                 <td>
                                                     <asp:DropDownList ID="DropDownListType" runat="server">
                                                         <asp:ListItem Selected="True">بخشنامه</asp:ListItem>
                                                         <asp:ListItem>اطلاعیه</asp:ListItem>
                                                         <asp:ListItem>مکاتبات</asp:ListItem>
                                                         <asp:ListItem>متفرقه</asp:ListItem>
                                                     </asp:DropDownList>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td>
                                                     <asp:Label ID="Label2" runat="server" Text="توضیحات :"></asp:Label>
                                                 </td>
                                                 <td>
                                                     <asp:TextBox ID="txtdescription" runat="server" Height="102px" 
                                                         TextMode="MultiLine" Width="246px"></asp:TextBox>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td>
                                                     <asp:Label ID="Label3" runat="server" Text="انتخاب فایل :"></asp:Label>
                                                 </td>
                                                 <td>
                                                  <div>
                                                     <uc1:MultipleFileUpload ID="MultipleFileUpload1" runat="server" 
                                                         OnClick="Multifileupload1_click" />
                                                  </div>
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td>
                                                     <asp:Label ID="Lblstatus" runat="server"></asp:Label>    &nbsp;</td>
                                                 <td>
                                                     &nbsp;</td>
                                             </tr>
                                         </table>
                                     
                                      </ContentTemplate>
                                 </uc3:Holder1>
                                 </asp:Panel>
                                 </td>
                             </tr>
                             <tr>
                                 <td>
                              
                                     <asp:Panel ID="PanelDownload" runat="server" BorderStyle="Solid" 
                                         BorderWidth="1px"  ScrollBars="Auto" Direction="RightToLeft" CssClass="style1">
                                  <uc3:Holder1 ID="Holder2" runat="server"  Title="دریافت مدارک">
                                 <ContentTemplate>
                                 
                                         <table class="style1">
                                             <tr>
                                                 <td>
                                                                              <asp:DropDownList ID="DropDownListTypeDown" runat="server" AutoPostBack="True" 
                                                     onselectedindexchanged="DropDownList1_SelectedIndexChanged">
                                                        
                                                         <asp:ListItem Selected="True">بخشنامه</asp:ListItem>
                                                         <asp:ListItem>اطلاعیه</asp:ListItem>
                                                         <asp:ListItem>مکاتبات</asp:ListItem>
                                                         <asp:ListItem>متفرقه</asp:ListItem>
                                                     </asp:DropDownList>
                                                    
                                                 </td>
                                             </tr>
                                             <tr>
                                                 <td>
                                                     <asp:DataList ID="DataListFileDownload" runat="server" 
                                                         DataSourceID="SqlDataSourceDocs" DataKeyField="ID1" CellPadding="4" 
                                                         ForeColor="#333333">
                                                         
                                                       
                                                         <AlternatingItemStyle BackColor="White" />
                                                         <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                         <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                         <ItemStyle BackColor="#EFF3FB" />
                                                         
                                                       
                                                         <ItemTemplate>
                                                             <div style="width:100%; direction:rtl;">
                                                                 <table class="style2" align="right" border="4">
                                                                     <tr>
                                                                         <td>
                                                                             <asp:Label ID="LabelFileName" runat="server" 
                                                                                 Text='<%# Eval( "OriginalFileName" ) %>'></asp:Label>
                                                                         </td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             <asp:Label ID="LabelDate" runat="server" dir="rtl" 
                                                                                 Text='<%# PersianDateControls.Convertor.ToPersianDate( Convert.ToDateTime( Eval( "Date" ) ) ) + " "
                                     + Convert.ToDateTime( Eval( "Date" ) ).ToShortTimeString().Replace( "AM", "صبح" ).Replace( "PM", "عصر" ) %>'></asp:Label>
                                                                         </td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             <asp:Label ID="LabelDesc" runat="server" 
                                                                                 Text='<%# "توضیحات :" + Eval( "Description" ) %>'></asp:Label>
                                                                         </td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             &nbsp;</td>
                                                                         <td>
                                                                             <asp:LinkButton ID="LinkButton1" runat="server" 
                                                                                 CommandArgument='<%# Eval( "Id1" ) %>' OnClick="ClickDownload"> دریافت فایل</asp:LinkButton>
                                                                         </td>
                                                                     </tr>
                                                                 </table>
                                                                 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                                                             </div>
                                                         </ItemTemplate>
                                                         <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                                     </asp:DataList>
                                                     
                                                     <asp:SqlDataSource ID="SqlDataSourceDocs" runat="server" 
                                                         ProviderName="System.Data.SqlClient" SelectCommand="SELECT     dbo.TblDocuments.*, dbo.TblFiles.*
FROM         dbo.TblDocuments INNER JOIN
                      dbo.TblFiles ON dbo.TblDocuments.ID = dbo.TblFiles.DocId
where @Type=dbo.TblDocuments.Type ORDER BY Date DESC">
                                                         <SelectParameters>
                                                             <asp:SessionParameter Name="Type" SessionField="Type" />
                                                         </SelectParameters>
                                                     </asp:SqlDataSource>
                                                 </td>
                                             </tr>
                                             
                                         </table>
                                         </ContentTemplate>
                                         </uc3:Holder1>
                                     </asp:Panel>
                                      
                                 </td>
                                 </tr>
                                 <tr>
                                                 <td>
                                                     <asp:Panel ID="PanelEdit" runat="server" BorderStyle="Solid" 
                                         BorderWidth="1px"  ScrollBars="Auto" Direction="RightToLeft" CssClass="style1">
                                                         <uc3:Holder1 ID="Holder3" runat="server"  Title="حذف مدارک">
                                 <ContentTemplate>
                                                         <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                                                             AutoGenerateColumns="False" DataKeyNames="ID,ID1" 
                                                             DataSourceID="SqlDataSourceDocEdit" EnableModelValidation="True" 
                                                             onrowcreated="GridView1_RowCreated" 
                                                             onrowdatabound="GridView1_RowDataBound" 
                                                             EmptyDataText="هیچ فایلی یافت نشد." CellPadding="4" ForeColor="#333333" 
                                                             GridLines="None">
                                                             <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                                             <Columns>
                                                                 <asp:CommandField ShowDeleteButton="True" DeleteText="حذف"  ItemStyle-Width="100" />
                                                                 <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                                                                     SortExpression="ID" Visible="False" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="Type" HeaderText="نوع فایل" SortExpression="Type" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="Description" HeaderText="توضیحات" 
                                                                     SortExpression="Description"  ItemStyle-Width="100" />
                                                                 <asp:BoundField DataField="ID1" HeaderText="ID1" ReadOnly="True" 
                                                                     SortExpression="ID1" Visible="False"  ItemStyle-Width="100" />
                                                                 <asp:BoundField DataField="TaskId" HeaderText="TaskId" SortExpression="TaskId" 
                                                                     Visible="False" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="FileName" HeaderText="FileName" 
                                                                     SortExpression="FileName" Visible="False"  ItemStyle-Width="100" />
                                                                 <asp:BoundField DataField="Date" HeaderText="تاریخ" SortExpression="Date" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="OriginalFileName" HeaderText="نام فایل" 
                                                                     SortExpression="OriginalFileName" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" 
                                                                     Visible="False" ItemStyle-Width="100"  />
                                                                 <asp:BoundField DataField="DocId" HeaderText="DocId" SortExpression="DocId" 
                                                                     Visible="False" ItemStyle-Width="100"  />
                                                             </Columns>
                                                             <EditRowStyle BackColor="#999999" />
                                                             <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                             <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                             <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                             <RowStyle BackColor="#F7F6F3" ForeColor="#333333" CssClass="style1" />
                                                             <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                         </asp:GridView>
                                                         <asp:SqlDataSource ID="SqlDataSourceDocEdit" runat="server" 
                                                             DeleteCommand="DELETE FROM TblFiles FROM TblFiles INNER JOIN TblDocuments ON TblFiles.DocId = TblDocuments.ID WHERE (TblFiles.Id = @ID1)" 
                                                             ProviderName="System.Data.SqlClient" 
                                                             
                                                             SelectCommand="SELECT TblDocuments.*, TblFiles.* FROM TblDocuments INNER JOIN TblFiles ON TblDocuments.ID = TblFiles.DocId ORDER BY Date DESC" >
                                                               <DeleteParameters>
                                                                 <asp:Parameter Name="ID1" />
                                                             </DeleteParameters>
                                                         </asp:SqlDataSource>
                                                     </ContentTemplate>
                                                     </uc3:Holder1>
                                                     </asp:Panel>
                                                 </td>
                                             </tr>
                           
                                                     
                                                     
                         </table>
    <%--  </ContentTemplate>
           
                 </asp:RoleGroup>
                 <asp:RoleGroup Roles="Surveyor,Advisor">
                 </asp:RoleGroup>
             </RoleGroups>
     </asp:LoginView>  --%>
       
      
    

</asp:Content>

